package com.springboot2.service.Impl;


import com.springboot2.entity.Files;
import com.springboot2.entity.User;
import com.springboot2.mapper.FilesMapper;
import com.springboot2.service.FilesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class FilesServiceImpl implements FilesService {

    @Resource
    private FilesMapper filesMapper;

    @Override
    public void add(Files files) {
        filesMapper.add(files);
    }

    @Override
    public void del(int id) {
        filesMapper.del(id);
    }

    @Override
    public void update(Files files) {
        filesMapper.update(files);
    }

    @Override
    public Files findById(int id) {
        return filesMapper.findById(id);
    }

    @Override
    public List<Files> findAll() {
        return filesMapper.findAll();
    }

    @Override
    public List<Files> findByPage(int pageNo, int pageSize) {
        Map<String,Integer> map = new HashMap<>();
        map.put("pageNo",(pageNo-1)*pageSize);
        map.put("pageSize",pageSize);
        return filesMapper.findByPage(map);
    }

    @Override
    public int count() {
        return filesMapper.count();
    }
}
